package com.cvmars.jianyou.module.adapter;

import android.content.Context;
import android.support.annotation.Nullable;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.cvmars.jianyou.R;
import com.cvmars.jianyou.model.ImageModel;
import com.cvmars.jianyou.utils.DensityUtils;

import java.util.List;

/**
 * Created by hehaifeng on 2018/12/2.
 */

public class FindImageWeiboAdapter extends BaseQuickAdapter<ImageModel, BaseViewHolder> {


    Context mContext;

    public FindImageWeiboAdapter(Context context, int layoutResId, @Nullable List<ImageModel> data) {
        super(layoutResId, data);
        mContext = context;
    }

    @Override
    protected void convert(BaseViewHolder helper, ImageModel item) {

        ImageView image = helper.getView(R.id.iv_find_img);
        Glide.with(mContext).load(item.imgPath).into(image);
        int width = DensityUtils.dp2px(mContext, DensityUtils.getWindowWidth(mContext)) - DensityUtils.dp2px(mContext, 50);
        image.getLayoutParams().height = width / 3;

    }
}
